﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SupWebSocketClientTest
{
    public partial class ReceivefileForm : Form
    {
        public ReceivefileForm()
        {
            InitializeComponent();
        }

        public ReceivefileForm(string Name, string Type, byte[] Data)
            : this()
        {
            Bitmap image = null;
            switch (Type)
            {
                case "jpg":
                case "png":
                case "bmp":
                    using (System.IO.Stream streamData = new System.IO.MemoryStream(Data))
                    {
                        image = (Bitmap)Image.FromStream(streamData);
                    }                    
                    pictureBox1.BackgroundImage = image;
                    break;
            }
            this.lblFileName.Text = Name + "." + Type;
        }

        private void btnSave_Click(object sender, EventArgs e)
        {

        }
    }
}
